package entity;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class FillModel {

    private boolean addColumn;
    private String modelName;
    private String packageName;
    private String entityName;
    private String prefixEntityName;
    private String urlPrefix;
    private String title;
    private String table;
    private String subPackage;
    private List<Map<String,String>> columns;

    public boolean isAddColumn() {
        return addColumn;
    }

    public void setAddColumn(boolean addColumn) {
        this.addColumn = addColumn;
    }

    public String getModelName() {
        return modelName;
    }

    public void setModelName(String modelName) {
        this.modelName = modelName;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public String getEntityName() {
        return entityName;
    }

    public void setEntityName(String entityName) {
        this.entityName = entityName;
    }

    public String getPrefixEntityName() {
        return prefixEntityName;
    }

    public void setPrefixEntityName(String prefixEntityName) {
        this.prefixEntityName = prefixEntityName;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTable() {
        return table;
    }

    public void setTable(String table) {
        this.table = table;
    }

    public String getUrlPrefix() {
        return urlPrefix;
    }

    public void setUrlPrefix(String urlPrefix) {
        this.urlPrefix = urlPrefix;
    }

    public String getSubPackage() {
        return subPackage;
    }

    public void setSubPackage(String subPackage) {
        this.subPackage = subPackage;
    }

    public List<Map<String, String>> getColumns() {
        return columns;
    }

    public void setColumns(List<Map<String, String>> columns) {
        this.columns = columns;
    }

    public Map<String,Object> asMap(){
        Map<String,Object> m = new HashMap<>();
        Field[] fields = this.getClass().getDeclaredFields();
        for (Field field : fields) {
            try {
                m.put(field.getName(),field.get(this));
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
//        m.put("addColumn",this.addColumn);
//        m.put("modelName",this.modelName);
//        m.put("packageName",this.packageName);
//        m.put("entityName",this.entityName);
//        m.put("prefixEntityName",this.prefixEntityName);
//        m.put("urlPrefix",this.urlPrefix);
//        m.put("title",this.title);
//        m.put("table",this.table);
//        m.put("subPackage",this.subPackage);
//        m.put("columns",this.columns);
        return m;
    }
}
